<?php
    session_start();
?>
<!-- InstanceBegin template="/Templates/admin_template.dwt.php" codeOutsideHTMLIsLocked="false" --><?php
	include("../Connect/connection.php")
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<title>Admin page</title>

<!-- CSS -->
<link href="style/css/transdmin.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie6.css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie7.css" /><![endif]-->

<!-- JavaScripts-->
<script type="text/javascript" src="style/js/jquery.js"></script>
<script type="text/javascript" src="style/js/jNice.js"></script>
<script src="datetimepicker_css.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>

<body>
<div id="wrapper">
    	<!-- h1 tag stays for the logo, you can use the a tag for linking the index page -->
    	        
        <!-- You can name the links with lowercase, they will be transformed to uppercase by CSS, we prefered to name them with uppercase to have the same effect with disabled stylesheet -->
        <ul id="mainNav">
        	<li><a href="#" class="active">ADMIN</a></li> <!-- Use the "active" class for the active menu item  -->
        	
        	<li class="logout"><a href="login.php">LOGOUT</a></li>
        </ul>
        <!-- // #end mainNav -->
        <div id="containerHolder">
			<div id="container">
       		  <div id="sidebar">
                	<ul class="sideNav">
                    	<li><a href="listnews.php">List News</a></li>
                    	<li><a href="addnews.php">Add News</a></li>
                    	<li><a href="listcar.php">List Cars</a></li>
                    	<li><a href="addcar.php">Add Cars</a></li>
                    	<li><a href="listcompany.php">List Companies</a></li>
                    	<li><a href="addcompany.php">Add Companies</a></li>
                    	<li><a href="listorder.php">Oders</a></li>
                    	<li><a href="listordersubmit.php">Oders submit</a></li>
                    	<li><a href="listcustomer.php">Customers</a></li>
                    </ul>
                    <!-- // .sideNav -->
                </div>    
                <!-- // #sidebar -->
                
                <!-- h2 stays for breadcrumbs -->
                <!-- InstanceBeginEditable name="EditRegion2" -->
                <div id="main">
                <?php
                        if (!isset($_SESSION["AdminID"])){
                            echo("<script>alert('Login, please !');</script>");
                            echo("<script>window.location='login.php';</script>");
                        }else{
                            if($_SESSION["AdminID"] == ''){
                                echo("<script>alert('Dang Nhap, please !');</script>");
                                echo("<script>window.location='login.php';</script>");
                            }
              			}
                    ?>
                	<?php
					if(isset($_REQUEST["id"])){
						$id = $_REQUEST["id"];
						$query = mysql_query("select * from cars where CarID=$id");
						while($rs=mysql_fetch_array($query)){
							$title=$rs['Name'];
							$sub=$rs['Sumary'];
							$content=$rs['Content'];
							$status==$rs['Status'];
							$image=$rs['Image'];
							$company=$rs['ComID'];
								$queryCom = mysql_query("select * from company where ComID=$company");
								while($rsCom=mysql_fetch_array($queryCom)){
									$comName = $rsCom['Name'];
									}
							$date=$rs['TimeProduction'];
							?>
                  <table>
                  <tr>
                  <td style="width:700px" align="center"><span style="font-size:18px"><b><?= $title?></b></span></td>
                  </tr>
                  
                  <tr>
                  <td style="width:700px"><span style="font-size:16px"><?= $sub?></span></td>
                  </tr>
                  
                  <tr>
                  <td style="width:700px" align="center"><img style="width:400px" src="../images/<?=$image ?> " /></td>
                  </tr>
                  
                  <tr>
                  <td style="width:700px"><?= $content?></td>
                  </tr>
                  <tr>
                  <td style="width:700px; height:50px; margin-top:10px;"><span style="line-height:50px; font-size:1.2em"><b>Time Production: </b><?= $date?></span></td>
                  </tr>
                  <tr>
                  <td style="width:700px; height:50px; margin-top:10px;"><span style="line-height:50px; font-size:1.2em"><b>Manufacturers :</b><?= $comName?></span></td>
                  </tr>
                  <tr>
                  <td align="right" style="width:600px">    
                         <a href="listcar.php?id=<?=$id?>">
                        <img src="../images/delete.png" onClick="return confirm('Are you sure ?');"/>
                        </a>       
                        <a href="updatecar.php?id=<?=$id?>">
                        <img src="../images/edit.png" />
                        </a>  
                  </td>
                  </tr>
                  </table>
                            
                             <?php
							};
					}else{
        echo("<script>window.location='listcar.php'</script>");
    }
				?>
                </div>
                <!-- InstanceEndEditable -->
                <!-- // #main -->
                
              <div class="clear"></div>
            </div>
            <!-- // #container -->
        </div>	
        <!-- // #containerHolder -->
        
        <p id="footer">EPROJECT SEM I - APTECH</p>
    </div>
</body>
<!-- InstanceEnd -->